<?php
  class mySearchParameterLib{
  
    static function build_query($s){
      $skeys = sfContext::getInstance()->getRequest()->getParameterHolder()->get($s);
      $query = array();
      $query_string = '';
      if($skeys){
        foreach(array_keys($skeys) as $skey)
          if($skeys[$skey])
            $query[] = $s.'['.$skey.']'.'='.$skeys[$skey];
        if(count($query)>0)
          $query_string = implode('&',$query);
      }
      return $query_string;
    }
    
    static function build_hidden_fields($s){
      $skeys = sfContext::getInstance()->getRequest()->getParameterHolder()->get($s);
      $query_string = '';
      if($skeys)
        foreach(array_keys($skeys) as $skey)
          if($skeys[$skey])
            $query_string .= '<input type="hidden" name = "'.$s.'['.$skey.']" value="'. $skeys[$skey]."\">\n";
      return $query_string;
    }
  
  }
?>